<?php
	if(!isset($_REQUEST['ajax'])){ $_REQUEST['ajax'] = "";}
	if($_REQUEST['ajax']!=true) include 'header.tpl.php';
	include 'task_panel.tpl.php';
?>
	<input type=hidden id=tidhid value='<?php echo $this->item['tId'];?>'>
	<div class="row">
		<div class="col-lg-4">
			<div class="panel">
				<div class="panel-heading">
					<div class="panel-title"><i class="icon-list"></i> <?php echo $this->language['detail'];?></div>
				</div>
				<div class="panel-body">
					<ul class="list-group">
						<li class="list-group-item">
							<b><?php echo $this->language['project'];?></b>
							<?php if($this->item['tType']==1): ?>
								<span class="pull-right"><a href="#project_view/pid=<?php echo $this->item['tTarget'];?>"><?php echo $this->item['pName'];?></a> <?php if(check_permission('project_edit')):?><a href="#update_project" data-toggle="modal"><i class="icon-pencil"></i></a><?php endif;?></span>
							<?php else:?>
								<span class="pull-right">Không có <?php if(check_permission('project_edit')):?><a href="#update_project" data-toggle="modal"><i class="icon-pencil"></i></a><?php endif;?></span>
							<?php endif;?>
							<div class="clear"></div>
						</li>
						<li class="list-group-item">
							<b><?php echo $this->language['task_code'];?></b>
							<span class="pull-right"><?php echo $this->item['tCode'];?></span>
							<div class="clear"></div>
						</li>
						<li class="list-group-item">
							<b><?php echo $this->language['creator'];?></b>
							<span class="pull-right"><?php echo $_SESSION['user_data'][$this->item['tCreateUser']]['fullname']?></span>
							<div class="clear"></div>
						</li>
						<li class="list-group-item">
							<b><?php echo $this->language['receiver'];?></b>
							<span class="pull-right"><?php echo $_SESSION['user_data'][$this->item['tAcceptUser']]['fullname'];?></span>
							<div class="clear"></div>
						</li>
						<li class="list-group-item">
							<b><?php echo $this->language['task_create_date'];?></b>
							<span class="pull-right"><?php echo date("d/m/Y",$this->item['tCreateTime']);?></span>
							<div class="clear"></div>
						</li>
						<li class="list-group-item">
							<b><?php echo $this->language['task_accept_date'];?></b>
							<span class="pull-right"><?php echo ($this->item['tAcceptTime'] > 0) ? date("d/m/Y",$this->item['tAcceptTime']) : "Chưa chấp nhận";?></span>
							<div class="clear"></div>
						</li>
						<li class="list-group-item">
							<b><?php echo $this->language['task_start_date'];?></b>
							<span class="pull-right"><?php echo date("d/m/Y",$this->item['tStartTime']);?></span>
							<div class="clear"></div>
						</li>
						<li class="list-group-item">
							<b><?php echo $this->language['task_end_date'];?></b>
							<span class="pull-right"><?php echo date("d/m/Y",$this->item['tDeadTime']);?></span>
							<div class="clear"></div>
						</li>
						<li class="list-group-item">
							<b><?php echo $this->language['status'];?></b>
							<span class="pull-right">
								<?php
									if($this->item['tStatus']==0) echo "<span class='label label-waiting'>".$this->language['waiting']."</span>";
									elseif($this->item['tStatus']==1) echo "<span class='label label-process'>".$this->language['processing']."</span>";
									elseif($this->item['tStatus']==2) echo "<span class='label label-preview'>".$this->language['testing']."</span>";
									elseif($this->item['tStatus']==3) echo "<span class='label label-complete'>".$this->language['completed']."</span>";
									elseif($this->item['tStatus']==-1) echo "<span class='label label-deny'>".$this->language['cancelled']."</span>";
									else echo $this->language['unknown'];
								?>
							</span>
							<div class="clear"></div>
						</li>
						<li class="list-group-item">
							<b><?php echo $this->language['last_activity'];?></b>
							<span class="pull-right"><?php echo $this->item['tLastActivityDesc']." - ".date("d/m/Y",$this->item['tLastActivity']);?></span>
							<div class="clear"></div>
						</li>
					</ul>
					<div class="clear"></div>
					<?php if(isset($this->displayBtn)) echo $this->displayBtn;?>
				</div>
			</div>
			<div class="panel">
				<div class="panel-heading">
					<div class="panel-title"><i class="icon-file-text-alt"></i> <?php echo $this->language['task_attach'];?></div>
				</div>
				<div class="panel-body">
					<ul class="list-group">
						<li class="list-group-item">
							<b><?php echo $this->language['requests'];?></b>
							<span class="pull-right">
								<?php
									if(count($this->phieutamung)>0){
										echo "<ul>";
										foreach($this->phieutamung as $item){
											echo "<li><a href='#request_view/id=".$item['req_id']."'>".$item['req_reason']."</a>";
											if($item['req_signature1']=='1') echo " - <font color=green>Đã Duyệt</font>";
											else echo " - <font color=red>Chưa Duyệt</font>";
											echo "</li>";
										}
										echo "</ul>";
									}
									else echo "Không có";
								?>
							</span>
							<div class="clear"></div>
						</li>
						<li class="list-group-item">
							<b><?php echo $this->language['attach_file'];?></b>
							<span class="pull-right">
								<?php
									if($this->item['tFile1']!=""){
										$f1 = explode(";",$this->item['tFile1']);
										echo "<ul>";
										foreach($f1 as $file){
											$filepath = explode(".",$file);
											$ext = $filepath[count($filepath)-1];
											if($ext == 'png') $imgsrc = 'png';
											elseif($ext == 'doc' || $ext == 'docx') $imgsrc = 'doc';
											elseif($ext == 'xls' || $ext == 'xlsx') $imgsrc = 'xls';
											elseif($ext == 'ppt' || $ext == 'pptx') $imgsrc = 'png';
											elseif($ext == 'psd') $imgsrc = 'psd';
											elseif($ext == 'tif') $imgsrc = 'tiff';
											elseif($ext == 'pdf') $imgsrc = 'pdf';
											elseif($ext == 'jpg') $imgsrc = 'jpg';
											else $imgsrc = 'unk';
											if($file!="")  echo "<li><img src='/resources/images/iconsd/".$imgsrc.".png' width=16px height=16px /> <a href='download.php?file=".$file."'>$file</a></li>";
										}
										echo "</ul>";
									}
									else echo "Không có";
								?>
							</span>
							<div class="clear"></div>
						</li>
						<?php if($this->item['tFile2']!=""){ ?>
						<li class="list-group-item">
							<b><?php echo $this->language['complete_file'];?></b>
							<span class="pull-right">
								<?php
									$f2 = explode(";",$this->item['tFile2']);
									echo "<ul>";
									foreach($f2 as $file){
										$filepath = explode(".",$file);
										$ext = $filepath[count($filepath)-1];
										if($ext == 'png') $imgsrc = 'png';
										elseif($ext == 'doc' || $ext == 'docx') $imgsrc = 'doc';
										elseif($ext == 'xls' || $ext == 'xlsx') $imgsrc = 'xls';
										elseif($ext == 'ppt' || $ext == 'pptx') $imgsrc = 'png';
										elseif($ext == 'psd') $imgsrc = 'psd';
										elseif($ext == 'tif') $imgsrc = 'tiff';
										elseif($ext == 'pdf') $imgsrc = 'pdf';
										elseif($ext == 'jpg') $imgsrc = 'jpg';
										else $imgsrc = 'unk';
										if($file!="")  echo "<li><img src='/resources/images/iconsd/".$imgsrc.".png' width=16px height=16px /> <a href='download.php?file=".$file."'>$file</a></li>";
									}
									echo "</ul>";
								?>
							</span>
							<div class="clear"></div>
						</li>
						<?php } ?>
					</ul>
				</div>
			</div>
			<?php if(isset($this->isAcceptUser) && $this->item['tStatus'] == 1){ ?>
			<div class="panel">
				<div class="panel-heading">
					<div class="panel-title"><i class="icon-cog"></i> <?php echo $this->language['task_update'];?></div>
				</div>
				<div class="panel-body">
					<form action="javascript:updateTask();" class="form-horizontal">
						<div class="form-group">
							<label class="col-lg-4 control-label"><?php echo $this->language['status'];?></label>
							<div class="col-lg-8">
								<div class="input-group">
									<input type="text" class="form-control" name="percent" id="percent" value="<?php echo $this->item['tPercent'];?>" />
									<span class="input-group-addon">%</span>
								</div>
							</div>
						</div>
						<div class="form-group">
							<div class="col-lg-offset-4 col-lg-8"><button class="col-offset-4 btn btn-warning" type="submit"><?php echo $this->language['update'];?></button></div>
						</div>
					</form>
				</div>
			</div>
			<div class="panel">
				<div class="panel-heading">
					<div class="panel-title"><i class="icon-cog"></i> Hoàn thành công việc</div>
				</div>
				<div class="panel-body">
					<form action="javascript:submitTask();" class="form-horizontal">
						<div class="form-group">
							<label class="col-lg-4 control-label"><?php echo $this->language['attach_file'];?></label>
							<div class="col-lg-8">
								<div id="file-uploader"></div>
								<input type=hidden id="uploadfile" name="uploadfile" value="">
								<div id="uploaded"></div>
							</div>
						</div>
						<div class="form-group">
							<div class="col-lg-offset-4 col-lg-8"><button class="col-offset-4 btn btn-primary" type="submit"><?php echo $this->language['completed'];?></button></div>
						</div>
					</form>
				</div>
			</div>
			<?php }if(isset($this->isCreator) && $this->item['tStatus'] < 2){ ?>
			<div class="panel">
				<div class="panel-heading">
					<div class="panel-title"><i class="icon-cog"></i> <?php echo $this->language['task_functions'];?></div>
				</div>
				<div class="panel-body">
					<form action="javascript:editTask();" class="form-horizontal">
						<div class="form-group">
							<label class="col-lg-4 control-label"><?php echo $this->language['task_start_date'];?></label>
							<div class="col-lg-8">
								<input class="form-control" type="text" name="taskStart" id="datepicker1" value="<?php echo date("d-m-Y",$this->item['tStartTime']);?>" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-lg-4 control-label"><?php echo $this->language['task_end_date'];?></label>
							<div class="col-lg-8">
								<input class="form-control" type="text" name="taskDead" id="datepicker" value="<?php echo date("d-m-Y",$this->item['tDeadTime']);?>" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-lg-4 control-label"><?php echo $this->language['attach_file'];?></label>
							<div class="col-lg-8">
								<div id="file-uploader-creator"></div>
								<input type=hidden id="uploadfile" name="uploadfile" value="">
								<div id="uploaded-creator"></div>
							</div>
						</div>
						<div class="form-group">
							<div class="col-lg-offset-4 col-lg-8">
								<button class="btn btn-primary" type="submit"><?php echo $this->language['update'];?></button>
								<button class="btn btn-deny" onClick="deleteTask();"><?php echo $this->language['task_delete'];?></button>
							</div>
						</div>
					</form>
					<form action="javascript:changeUserTask();" class="form-horizontal">
						<div class="form-group">
							<label class="col-lg-4 control-label"><?php echo $this->language['task_transfer'];?></label>
							<div class="col-lg-8">
								<select name="receiver" id="receiver" class="form-control"></select>
							</div>
						</div>
						<div class="form-group">
							<div class="col-lg-offset-4 col-lg-8">
								<button class="btn btn-primary" type="submit"><?php echo $this->language['transfer'];?></button>
							</div>
						</div>
					</form>
					<?php if($this->item['tType']==0){ ?>
					<script>
					    $(document).ready(function() {
							$("#receiver").html('');
							$.getJSON("?func=task_ajax",{type: 0}, function(data){
							  var selectm = $('#receiver');
								$.each(data, function (key, cat) {
								var group = $('<optgroup>',{label:key});
								$.each(cat,function(i,item) {
									$("<option/>",{value:item.optval,text:item.optdis}).appendTo(group);
								});
								group.appendTo( selectm );
							});
							})
						});
					</script>
					<?php }elseif($this->item['tType']==1){ ?>
					<script>
					    $(document).ready(function() {
							$("#receiver").html('');
							$.getJSON("?func=task_ajax",{type: '1',pid: '<?php echo $this->item['tTarget'];?>'}, function(j){
							  var options = '';
							  for (var i = 0; i < j.length; i++) {
								options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
							  }
							  $("#receiver").html(options);
							})
						});
					</script>
					<?php } ?>
				</div>
			</div>
			<?php } ?>
		</div>
		<div class="col-lg-8">
			<div class="panel">
				<div class="panel-heading">
					<div class="panel-title"><i class="icon-file-text-alt"></i> <?php echo $this->language['task_content'];?></div>
				</div>
				<div class="panel-body">
					<form action="javascript:;" onClick="return false;">
						<div class="form-group">
							<label><?php echo $this->language['task_name'];?> : <font color=red><?php echo $this->item['tTitle'];?></font></label>
							<?php if(isset($this->isCreator) && $this->item['tStatus']==0){ ?>
							<textarea class="form-control wysiwyg" id="textarea" name="taskContent" rows="12"><?php echo $this->item['tContent'];?></textarea>
							<?php }else{ echo "<hr><p>".$this->item['tContent']."</p>"; } ?>
						</div>
						<?php if(isset($this->isCreator) && $this->item['tStatus']==0){ ?>
						<div class="form-group">
							<button class="btn btn-primary" onClick="editTaskContent();"><?php echo $this->language['update']; ?></button>
						</div>
						<?php } ?>
					</form>
				</div>
			</div>

			<?php if(count($this->tracks) > 0):?>
			<div class="panel">
				<div class="panel-heading">
					<div class="panel-title"><i class="icon-file-text-alt"></i> Bản đồ</div>
				</div>
				<div class="panel-body">
					<div class="row">
						<div class="col-lg-8">
							<div id="gmap"></div>
						</div>
						<div class="col-lg-4" id="gmap_data">
							<table class="table table-fixed table-striped table-condensed table-hover">
							<?php $stt = 0;foreach($this->tracks as $track):?>
								<tr>
									<td><a href="javascript:;" class="move-to-marker" data-marker-index="<?php echo $stt;?>" data-marker-lat="<?php echo $track['track_latitude'];?>" data-marker-lng="<?php echo $track['track_longitude'];?>"><?php echo $track['track_address'];?></a></td>
									<td width="50px"><?php echo date("H:i",$track['track_create_time']);?></td>
									<?php if(check_permission('project_edit')):?>
									<td width="55px">
										<?php if($track['track_status'] == 1):?>
										<font color=blue><i class="icon-ok"></i></font>
										<?php else:?>
										<input type="checkbox" onClick="track_verify(<?php echo $track['track_id'];?>);" />
										<?php endif;?>
										<a href="javascript:;" onClick="track_delete(<?php echo $track['track_id'];?>);"><font color="red"><i class="icon-remove"></i></font></a>
										<a href="./download.php?file=<?php echo urlencode(str_replace("uploads/","",$track['track_file']));?>"><i class="icon-download-alt"></i></a>
									</td>
									<?php endif;?>
								</tr>
							<?php $stt++;endforeach;?>
							</table>
						</div>
					</div>
				</div>
			</div>
			<?php endif;?>

			<div class="panel">
				<div class="panel-heading">
					<div class="panel-title"><i class="icon-file-text-alt"></i> <?php echo $this->language['task_comments'];?></div>
				</div>
				<div class="panel-body">
					<?php if(count($this->comments)>0){ ?>
					<div class="list-group">
						<?php foreach($this->comments as $comment){ ?>
						<div class="list-group-item">
							<?php if($comment['cCreateUser'] > 0):?>
							<h4 class="list-group-item-heading"><a href='#user_view/uId=<?php echo $comment['cCreateUser'];?>'><?php echo $_SESSION['user_data'][$comment['cCreateUser']]['fullname'];?></a> <small><?php echo date("H:i:s d/m/Y",$comment['cCreateTime']);?></small></h4>
							<p class="list-group-item-text">
								<?php
									if($comment['cFile']!=""){
										$f1 = explode(";",$comment['cFile']);
										echo "File đính kèm : <ul>";
										foreach($f1 as $file){
											$filepath = explode(".",$file);
											$ext = $filepath[count($filepath)-1];
											if($ext == 'png') $imgsrc = 'png';
											elseif($ext == 'doc' || $ext == 'docx') $imgsrc = 'doc';
											elseif($ext == 'xls' || $ext == 'xlsx') $imgsrc = 'xls';
											elseif($ext == 'ppt' || $ext == 'pptx') $imgsrc = 'png';
											elseif($ext == 'psd') $imgsrc = 'psd';
											elseif($ext == 'tif') $imgsrc = 'tiff';
											elseif($ext == 'pdf') $imgsrc = 'pdf';
											elseif($ext == 'jpg') $imgsrc = 'jpg';
											else $imgsrc = 'unk';
											if($file!="")  echo "<li><img src='resources/images/iconsd/".$imgsrc.".png' width=16px height=16px /> <a href='download.php?file=".$file."'>$file</a></li>";
										}
										echo "</ul>";
									}
								?>
								<?php echo nl2br($comment['cContent']);?>
							</p>
							<?php elseif($comment['cCreateCust'] > 0):?>
							<h4 class="list-group-item-heading"><?php echo $comment['cust_name'];?> <small><?php echo date("H:i:s d/m/Y",$comment['cCreateTime']);?></small></h4>
							<p class="list-group-item-text">
								<?php
									if($comment['cFile']!=""){
										$f1 = explode(";",$comment['cFile']);
										echo "File đính kèm : <ul>";
										foreach($f1 as $file){
											$filepath = explode(".",$file);
											$ext = $filepath[count($filepath)-1];
											if($ext == 'png') $imgsrc = 'png';
											elseif($ext == 'doc' || $ext == 'docx') $imgsrc = 'doc';
											elseif($ext == 'xls' || $ext == 'xlsx') $imgsrc = 'xls';
											elseif($ext == 'ppt' || $ext == 'pptx') $imgsrc = 'png';
											elseif($ext == 'psd') $imgsrc = 'psd';
											elseif($ext == 'tif') $imgsrc = 'tiff';
											elseif($ext == 'pdf') $imgsrc = 'pdf';
											elseif($ext == 'jpg') $imgsrc = 'jpg';
											else $imgsrc = 'unk';
											if($file!="")  echo "<li><img src='resources/images/iconsd/".$imgsrc.".png' width=16px height=16px /> <a href='download.php?file=".$file."'>$file</a></li>";
										}
										echo "</ul>";
									}
								?>
								<?php echo nl2br($comment['cContent']);?>
							</p>
							<?php endif;?>
						</div>
						<?php } ?>
					</div><hr/>
					<?php } ?>
					<form action="javascript:commentTask();">
						<div class="form-group">
							<label><?php echo $this->language['task_write_comment'];?></label>
							<textarea class="form-control" rows=4 id="taskComment" name="taskComment"></textarea>
						</div>
						<div class="form-group">
							<div id="file-uploader-cmt"></div>
							<input type=hidden id="uploadfilecmt" name="uploadfilecmt" value="">
							<div id="uploaded"></div>
						</div>
						<div class="form-group">
							<button class="btn btn-primary" type="submit"><?php echo $this->language['accept']; ?></button>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>

	<div class="modal fade" id="update_project" data-width="700">
		<div class="modal-dialog">
			<div class="modal-content">
				<form action="javascript:update_task_project();" id="form_update_tproject" class="form-horizontal">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title">Cập nhật Dự án</h4>
					</div>
					<div class="modal-body">
						<fieldset>
							<div class="form-group">
								<label class="control-label col-lg-3">Chọn dự án:</label>
								<div class="col-lg-9">
									<input type="text" id="search_project" class="form-control" placeholder="Mã hợp đồng / Tên dự án" />
									<select name="pid" id="list_project" class="form-control" size="7">
										<option value="0">Vui lòng chọn người nhận công việc</option>
									</select>
								</div>
							</div>
						</fieldset>
					</div>
					<div class="modal-footer">
						<input type="hidden" name="mod" value="update_project" />
						<input type="hidden" name="tid" value="<?php echo $this->item['tId'];?>" />
						<input type="submit" class="btn btn-primary" value="Đồng ý" />
					</div>
				</form>
			</div>
		</div>
	</div>
	<div class="clear"></div>
	<link href="resources/css/fileuploader.css" type="text/css" rel="stylesheet" />
	<script type="text/javascript" src="resources/scripts/jquery.datePicker.js"></script>
	<script type="text/javascript" src="resources/scripts/jquery.wysiwyg.js"></script>
	<script type="text/javascript" src="resources/scripts/fileuploader.js"></script>
	<script type="text/javascript" src="resources/scripts/gmaps.js"></script>
	<script>
	$(".wysiwyg").wysiwyg();
	$(function() {
		$( "#datepicker1" ).datepicker({dateFormat: 'dd-mm-yy'});
		$( "#datepicker" ).datepicker({dateFormat: 'dd-mm-yy'});
	});

	<?php if(count($this->tracks) > 0):?>
	map = new GMaps({
		div: '#gmap',
		lat: 10.786769,
		lng: 106.65537
    });
	<?php foreach($this->tracks as $track):?>
	map.addMarker({
		lat: <?php echo $track['track_latitude'];?>,
		lng: <?php echo $track['track_longitude'];?>,
		infoWindow:{
			content: '<p><a href="./<?php echo (stristr($track['track_file'],'.mov') || stristr($track['track_file'],'.mp4')) ? 'video.php?file=' : '';?><?php echo $track['track_file'];?>" title="<?php echo $track['track_address'];?>" class="fancybox <?php echo (stristr($track['track_file'],'.mov') || stristr($track['track_file'],'.mp4')) ? 'video' : '';?>" <?php echo (stristr($track['track_file'],'.mov') || stristr($track['track_file'],'.mp4')) ? 'data-type="iframe"' : '';?>><?php echo (stristr($track['track_file'],'.mov') || stristr($track['track_file'],'.mp4')) ? '<img src="./resources/images/video.jpg" />' : '<img src="./'.$track['track_file'].'" width="200px" />';?></a></p>',
			domready: function(e){
				$(".fancybox").on("click", function(){
					if($(this).hasClass('video')){
						$.fancybox({
				          href: this.href,
				          type: $(this).data("type"),
				          title: $(this).attr('title'),
				          width: 660,
				          height: 500
				        }); // fancybox
					}
					else{
						$.fancybox({
				          href: this.href,
				          type: $(this).data("type"),
				          title: $(this).attr('title')
				        }); // fancybox
					}
			        return false;
			    });
			}
		}
	});
	<?php endforeach;?>
	<?php endif;?>

	var uploader = new qq.FileUploader({
		element: document.getElementById('file-uploader-cmt'),
		action: 'file.php?act=upload',
		onComplete: function(id, fileName, responseJSON){
			var kq = responseJSON['success'];
			  if(kq == true){
				  var a = $("#uploadfilecmt").val();
				  $("#uploadfilecmt").val(a+';'+responseJSON['filename']);
				 }
		},
		debug: false
	});
	<?php if(isset($this->isAcceptUser) && $this->item['tStatus'] == 1){ ?>
	var uploader = new qq.FileUploader({
		element: document.getElementById('file-uploader'),
		action: 'file.php?act=upload',
		debug: false
	});
	<?php }?>
	<?php if(isset($this->isCreator) && $this->item['tStatus'] < 2){ ?>
	var uploader = new qq.FileUploader({
		element: document.getElementById('file-uploader-creator'),
		action: 'file.php?act=upload',
		debug: false
	});
	<?php }?>
	var timeout;

	$(document).on('click', '.move-to-marker', function(e) {
		e.preventDefault();

		var lat, lng;

		var $index = $(this).data('marker-index');
		var $lat = $(this).data('marker-lat');
		var $lng = $(this).data('marker-lng');

		if ($index != undefined) {
		// using indices
		var position = map.markers[$index].getPosition();
		lat = position.lat();
		lng = position.lng();
		}
		else {
		// using coordinates
		lat = $lat;
		lng = $lng;
		}

		map.setCenter(lat, lng);
		google.maps.event.trigger(map.markers[$index], 'click');
	});


	$("#search_project").keyup(function(){
		var k = $(this).val();
		if(k.length >= 3){
			clearTimeout(timeout);
			timeout = setTimeout(function(){
				$.ajax({
					type: 'POST',
					url: '?func=project_ajax',
					data: {
						mod: 'search_project',
						keyword: k,
						type: 'all'
					},
					dataType: 'json',
					success: function(msg){
						if(msg.result == true){
							var j = msg.projects;
							var options = '';
							for(var i = 0; i < j.length ; i++){
								options += '<option value="' + j[i].pId + '">' + j[i].pName + '</option>';
							}
							$('#list_project').html(options);
						}
					}
				});
			},1000);
		}
	});
	</script>
<?php if(isset($this->breadcrumb) && isset($this->title_header)):?>
	<script type="text/javascript">
		$(function() {
			$("#title-header").text('<?php echo $this->title_header;?>');
			$("#breadcrumb").html('<?php echo build_breadcrumb($this->breadcrumb);?>');
		});
	</script>
<?php endif;?>
<?php
	if($_REQUEST['ajax']!=true) include 'footer.tpl.php';
?>